<!DOCTYPE html>
<html>
<head>
    <title>JS--for--in</title>
    <meta charset="utf-8"/>
    <script>
        var arr = [1, 56, 34, 12];
        var total = 0;
        for (var i in arr) {
            total += parseInt(arr[i], 10);
        }
        console.log(total);
        console.log("-------------------------");

        var obj = {"id": 111, "name": "gaolei", "gender": "男", "age": 20, "List":[1, 2 ,3, 4]};
        for (var i in obj) {
            console.log(i + ":" + obj[i]);
        }
    </script>
</head>
<body>

</body>
</html>